﻿using System;

namespace TemplateEngine.TranslateFunctions
{
    internal class NowFunction : ICommand
    {
        public string Execute(System.Xml.XmlNode xmlNode, TemplateNode templateNode, object[] args)
        {
            DateTime now = DateTime.Now;
            if (args.Length > 0)
            {
                string formatStr = args[0].ToString();
                return now.ToString(formatStr);
            }

            return now.ToString();
        }
    }
}
